package com.atguigu.gmallpubliser.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface SugarMapper {

    @Select("SELECT sum(order_amount) order_amount FROM dws_trade_sku_order_window WHERE cur_date='${date}'")
    BigDecimal selectGmv(@Param("date") String date);

    //List[Map1[(tm_name->苹果),(order_amount->526411)],Map2[],Map3[],Map4[],Map5[]]
    @Select("SELECT trademark_name,sum(order_amount) order_amount FROM dws_trade_sku_order_window WHERE cur_date='${date}' GROUP BY trademark_name ORDER BY order_amount DESC LIMIT ${limit}")
    List<Map> selectGmvByTm(@Param("date") String date,
                            @Param("limit") int limit);
}
